import {ReqGetBaseCategoryList,ReqGetFloor,ReqGetSlide} from "@/api"
// 存储公共数据
const state = {
    categoryList:[],
    slide:[],
    floor:[]
}
const getters = {
     

}

const mutations = {
    SAVE_CATEGORY_LIST(state,value){
         state.categoryList=value.slice(0,15)
    },
    SAVE_SLIDE_LIST(state,value){
        state.slide = value;
    },
    SAVE_FLOOR_LIST(state,value){
        state.floor = value;
    }
}
const actions = {
       async GetCategoryList ({commit}){
    let data= await ReqGetBaseCategoryList()
             commit("SAVE_CATEGORY_LIST",data)
       } ,
       async GetSlide({commit}){
        let data = await ReqGetSlide();
        commit("SAVE_SLIDE_LIST",data);
    },
    async GetFloorList({commit}){
        let data = await ReqGetFloor();
        commit("SAVE_FLOOR_LIST",data);
    }
}
export default {
    namespaced: true  ,//局部使用命名空间
    state,
    actions,
    getters,
    mutations,

}